package simtester.agent;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;

public class AgentLogFormatter extends Formatter {
    DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss.SSS");

    @Override
    public String format(LogRecord rec) {
        StringBuilder buf = new StringBuilder(256);
        Date recDate = new Date(rec.getMillis());
        
        buf.append(dateFormat.format(recDate));
        buf.append(' ');
        buf.append(rec.getLevel());
        buf.append(": ");
        buf.append(rec.getMessage());
        buf.append('\n');
        
        return buf.toString();
    }

}
